# -*- coding: utf-8 -*-
# Author   : ZhangQing
# Time     : 2025-07-16 7:17
# File     : test.py
# Project  : dynamic-portfolio-optimizer
# Desc     :

import yfinance as yf
import os
proxy = 'http://127.0.0.1:7897' # 代理设置，此处修改
os.environ['HTTP_PROXY'] = proxy

# data = yf.download("AAPL")

ticker = yf.Ticker("AAPL", proxy)
print(ticker.isin)  # 检查是否返回正确ISIN代码（US0378331005）

# 获取苹果公司（AAPL）的历史数据
data = yf.download("AAPL", start="2023-01-01", end="2024-01-01", period="1d", auto_adjust=False, proxy=proxy)
# data = yf.download("AAPL", start="2023-01-01", end="2024-01-01", ignore_tz=False, prepost=True)
print(data.head())